home *** CD-ROM | disk | FTP | other *** search
- Path: ix.netcom.com!netnews
- From: judgemi@ix.netcom.com(Michael Judge )
- Newsgroups: comp.lang.c++
- Subject: Re: Change window application from one to another
- Date: 8 Feb 1996 15:15:00 GMT
- Organization: Netcom
- Message-ID: <4fd41k$aks@ixnews4.ix.netcom.com>
- References: <4facrt$s1g@unix.sbu.ac.uk>
- NNTP-Posting-Host: ix-bst-ma1-01.ix.netcom.com
- X-NETCOM-Date: Thu Feb 08 7:15:00 AM PST 1996
-
- In <4facrt$s1g@unix.sbu.ac.uk> suogui zhang <suorguz@vax.sbu.ac.uk>
- writes:
- >
- >hi friend:
- >I have some problem with window change from one application to
- another. Sometime the display
- >is not on the screen. Anybody can tell me how to get current window
- and how to change it to
- >another.
- >
- >thanks
- >
- >S.Zhang
- >
-
- you can use FindWindow and then SendMessage()
-
- t_Wnd = CWnd::FindWindow("Other App Window",NULL))
- if (t_Wnd)
- {
- // if so, does it have any popups?
- CWnd *ChildCWnd=t_Wnd->GetLastActivePopup();
-
- // Bring the main window to the top.
- t_Wnd->BringWindowToTop();
-
- // If iconic, restore the main window.
- if (t_Wnd->IsIconic())
- t_Wnd->ShowWindow(SW_RESTORE);
-
- // If there was an active popup, bring it along too!
- if (t_Wnd != ChildCWnd)
- ChildCWnd->BringWindowToTop();
- }
- This is for Visual C++. Straight API calls aren't far off from this.
-
- MJ
-